package org.nstack.header.network.l2;


import org.nstack.header.message.APICreateMessage;
import org.nstack.header.message.APIEvent;
import org.nstack.header.message.APIMessage;
import org.nstack.header.message.APIParam;
import org.nstack.header.notification.ApiNotification;
import org.nstack.header.zone.ZoneVO;



public abstract class APICreateL2NetworkMsg extends APICreateMessage {

    @APIParam(maxLength = 255)
    private String name;

    @APIParam(required = false, maxLength = 2048)
    private String description;

    @APIParam(resourceType = ZoneVO.class)
    private String zoneUuid;

    @APIParam(maxLength = 1024)
    private String physicalInterface;

    private String type;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getZoneUuid() {
        return zoneUuid;
    }

    public void setZoneUuid(String zoneUuid) {
        this.zoneUuid = zoneUuid;
    }

    public String getPhysicalInterface() {
        return physicalInterface;
    }

    public void setPhysicalInterface(String physicalInterface) {
        this.physicalInterface = physicalInterface;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public ApiNotification __notification__() {
        APIMessage that = this;

        return new ApiNotification() {
            @Override
            public void after(APIEvent evt) {
                if (evt.isSuccess()) {
                    ntfy("Created").resource(((APICreateL2NetworkEvent)evt).getInventory().getUuid(), L2NetworkVO.class.getSimpleName())
                        .messageAndEvent(that, evt).done();
                }
            }
        };
    }

}